<template>
    <el-tag :type="statusType" :effect="statusEffect">
        {{ statusText }}
    </el-tag>
</template>

<script>
export default {
    name: "RecordStatus",
    props: {
        // 记录状态
        status: {
            type: String,
            default: "0"
        },
        // 审批状态
        approvalStatus: {
            type: String,
            default: "0"
        }
    },
    computed: {
        // 状态类型
        statusType() {
            if (this.approvalStatus === "0") {
                return "info";
            } else if (this.approvalStatus === "1") {
                return "success";
            } else if (this.approvalStatus === "2") {
                return "danger";
            } else {
                return "warning";
            }
        },
        // 状态效果
        statusEffect() {
            return "light";
        },
        // 状态文本
        statusText() {
            if (this.approvalStatus === "0") {
                return "待审批";
            } else if (this.approvalStatus === "1") {
                return "已审批";
            } else if (this.approvalStatus === "2") {
                return "已驳回";
            } else {
                return "已取消";
            }
        }
    }
};
</script>

<style lang="scss" scoped>
.record-status {
    display: inline-block;
    margin-right: 10px;
}
</style>